/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {
   const map = {}
   for(let i = 0; i < nums.length; i++) {
    let temp = map[target - nums[i]]
    if(temp !== undefined) {
      return [temp, i]
    }
    map[nums[i]] = i
   }
};